<?php
$this->placeholder("navegacion")->set($this->navegacion($this->nav));

$domConfig = Zend_Registry::get('domConfig');
$perfil = App_Perfil::getInstance();
$perfil->cargar("VARIABLES");

$periodicidad = $this->variable["periodicidad"];
$tipovalor = ($this->variable["tiponaturaleza"]==1)?"valornum":"valortexto";

?>
<br/>
<table width="100%" align="center" class="iceDatTbl">
<tr>
	<th>Dimensi&oacute;n</th>
	<th>Periodicidad</th>
	<th>Unidad</th>
</tr>
 <TR class="iceDatTblRow1">
   <TD style="text-align:center;"><?php echo $this->variable["nombrevariable"];?></TD>
   <TD style="text-align:center;"><?php echo $domConfig->PERIODICIDAD->$periodicidad;?></TD>
   <TD style="text-align:center;"><?php echo $this->dimension[0]["nombreunidad"];?></TD>
 </TR>
</table>
<br/>
<BR></BR>

<div align="center">
<div style="width: 700px" class="center-block">
<?php
if ($perfil->crear()):
    echo $this->form;
endif;
?>
 </div>
<?php if(count($this->datos)>0):?>
<BR>
<form action="<?=$this->baseUrl("/variables/index/desasignarusuario");?>" method="post">
<INPUT type="hidden" id="codvariable" name="codvariable" value="<?php echo $this->variable["codvariable"]; ?>">
<INPUT type="hidden" id="coddimension" name="coddimension" value="<?php echo $this->dimension[0]["coddimension"]; ?>">
<table id="table_id" align="center" class="display">
  <thead>
    <tr>
      <th width="15%">Usuario</th>
      <th width="50%">Nombre</th>
      <th width="30%">Estado</th>
	  <th width="5%"></th>
    </tr>
  </thead>
  <tbody>
	<?php foreach ($this->datos as $value):?>
    <tr>
      <td style="text-align:center;"><?php echo $value["nombreusuario"];?></td>
      <td><?php echo "{$value["nombres"]} {$value["apellidos"]}";?></td>
      <td style="text-align:center;"><?php echo $domConfig->DOM_ESTADO->get($value["estado"]);?></td>
	  <td style="text-align:center;"><input type="checkbox" name="seleccionados[]" value="<?=$value["codusuario"];?>" /></td>
    </tr>
  <?php  endforeach;?>
  </tbody>
</table>
<?php
    if($perfil->eliminar()) {
?>
<div align="right"><input type="submit" value="Des-asignar usuario" class="btn btn-primary btn-sm" /></div>
<?php
    }
?>
</form>
<script type="text/javascript">
$(function() {
	var oTable = $('#table_id').dataTable({
		"bJQueryUI": true,
		"bAutoWidth": false,
 		"sPaginationType": "full_numbers",
 		"bStateSave": true,
 		"aoColumns": [
 	 		 			null,
 	 		 			null,
 	 		 			null,
 	 		 			{ "bSortable": false, "bSearchable": false }
 	 		 		 ]
	});
	oTable.fnSetFilteringDelay();
});
</script>
<?php else: echo "<BR>".$this->mensajes("No existen registros");?>
<?php endif; ?>
</div>